<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich">
	<h:form>
		<!-- Dummy Editor added to initialize CKEditor-javascript on load. without this, the text or html editor won't be rendered after type change -->
		<rich:editor id="dummyEditor" />
		<!-- Hide the editor immediately -->
		<rich:jQuery selector="#dummyEditor" query="hide()" />
		<rich:editor id="editor" toolbar="full"
			value="#{publicationBean.contenu}" style="margin-bottom: 1em">
			<f:ajax event="change" render="panel" />
			<f:ajax event="dirty" render="panel" />
		</rich:editor>
		<rich:panel id="panel" style="visibility: hidden;">
			<f:facet name="header">
                Output from Editor
                <a4j:status name="panelUpdateStatus">
					<f:facet name="start">
                        (Updating)
                    </f:facet>
				</a4j:status>
			</f:facet>
			<h:outputText escape="false" value="#{publicationBean.contenu}" />
		</rich:panel>
		<rich:jQuery selector="#panel" query="hide()" />
		<a4j:commandButton value=" " styleClass="boutonPosterMur"
			action="#{publicationBean.ajoutMessage()}" render="monActu, editor">
			<a4j:param id="emetteur" value="#{ObjetEleve.id_eleve}"
				assignTo="#{publicationBean.id_eleve_emetteur}" />
			<a4j:param id="destinataire" value="#{ObjetEleve.vue.id_eleve}"
				assignTo="#{publicationBean.id_eleve_destinataire}" />
			<a4j:param id="date" converter="javax.faces.DateTime"
				value="#{currentDate}" assignTo="#{publicationBean.date_envoie}" />
		</a4j:commandButton>
	</h:form>
</ui:composition>